package com.codejiwei.flink.udfs;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
import org.apache.flink.table.functions.ScalarFunction;
import org.apache.flink.types.Row;

import java.time.Instant;

/**
 * @author jiwei
 * @description
 * @date 2023/6/5 15:21
 */
public class Flink_UDF_OverloadFunction {
    public static void main(String[] args) {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);
        env.setParallelism(3);

        TestOverloadFunction udf = new TestOverloadFunction();
        Row eval = udf.eval(1628469056);
        System.out.println(eval);


    }

    public static class TestOverloadFunction extends ScalarFunction {
        public Row eval(int i) {
            return Row.of(String.valueOf(i), Instant.ofEpochSecond(i));
        }




    }
}
